home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Answers 2002 January
/
PC Answers January 2002.7z
/
PC Answers January 2002.bin
/
graphics
/
freepixl
/
_SETUP.1
/
Shade.pxl
< prev
next >
Wrap
Text File
|
2000-12-23
|
3KB
|
122 lines
Initialize:
WinGetActive(Win$)
UseCoordinates(PIXEL)
UseBackGround(TRANSPARENT,192,192,192)
DrawBackGround
WaitInput(100) {let NT and 95 catch up}
InfoMenu(REMOVE)
SetMenu()
WinLocate(Win$,200,100,700,580,Res)
Title$ = "Creating Color Gradients"
WinTitle(Win$, Title$)
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMenu("E&xit!",Leave,
ENDPOPUP,
"&Gradients",IGNORE,
"Shade &Command",ShadeCmd,
"Shade &Background",Shade2,
"Shade &Function",ShadeFn,
ENDPOPUP,
"&Help",IGNORE,
"&Concept",Concept,
"&About",About,
ENDPOPUP)
Wait_for_Input:
WaitInput()
Leave:
End
Concept:
MessageBox(OK,1,INFORMATION,
"Shaded regions are drawn, and mouse draw is enabled. Click on
the right mouse to indicate the current screen color, and to
change the mouse draw pen color.
The Shade Function demonstrates that using the DrawShadeRectangle
command is faster than the same function written as a draw loop.",
"Draw Shaded Rectangles Concepts",Res)
Goto Wait_for_Input
About:
AboutUser("Drawing Color Gradients",
"Sample PiXCL 4.0 program", "")
Goto Wait_for_Input
ShadeCmd:
DrawBackground
UsePen(SOLID,1,255,255,255)
UseBrush(NULL,0,0,0)
Y1 = 10 Y2 = Y1 + 180
Y3 = Y2 + 10 Y4 = Y3 + 180
SetRightMouse(cx1,cy1,cx2,cy2,Report,X,Y)
DrawRectangle(10,Y1,200,Y2)
DrawRectangle(210,Y1,400,Y2)
DrawRectangle(10,Y3,200,Y4)
DrawRectangle(210,Y3,400,Y4)
UsePen(SOLID,2,255,0,0)
SetDrawMouse(FOREGND)
DrawShadeRectangle(10,Y1,200,Y2, 0,0,0, 255,0,0,TOPBOTTOM)
DrawShadeRectangle(210,Y1,400,Y2, 0,0,0, 0,255,0,TOPBOTTOM)
DrawShadeRectangle(10,Y3,200,Y4, 0,0,0, 0,0,255,TOPBOTTOM)
DrawShadeRectangle(210,Y3,400,Y4, 0,0,0, 255,255,255,TOPBOTTOM)
WaitInput(1000)
DrawShadeRectangle(10,Y1,200,Y2, 128,128,0, 255,0,0,BOTTOMTOP)
DrawShadeRectangle(210,Y1,400,Y2, 0,160,0, 0,255,0,BOTTOMTOP)
DrawShadeRectangle(10,Y3,200,Y4, 0,0,160, 0,255,128,BOTTOMTOP)
DrawShadeRectangle(210,Y3,400,Y4, 0,0,0, 255,255,255,BOTTOMTOP)
Goto Wait_for_Input
Shade2:
DrawShadeRectangle(cx1,cy1,cx2,cy2, 0,0,160, 0,255,128,BOTTOMTOP)
Goto Wait_for_Input
Report:
UseBrush(SOLID,192,192,192)
UsePen(NULL,1,0,0,0)
DrawRectangle(410,10,500,100)
GetPixel(X,Y,R,G,B,Res)
DrawNumber(410,10,X) DrawNumber(460,10,Y)
DrawNumber(420,30,R)
DrawNumber(420,50,G)
DrawNumber(420,70,B)
UsePen(SOLID,1,R,G,B)
Goto Wait_for_Input
{ Draw_Blue_Shade: create a shaded background, black at top }
ShadeFn:
Set Counter = 1
Set Pen_Colour = 0
InitLoop_0:
Set Counter = 0
Set Br_Colour = 7
Set yY1 = cy1
While Counter <= cy2
UsePen(SOLID,1,0,0,Br_Colour)
yY1 = Counter
DrawLine(cx1,yY1,cx2,yY1)
If Br_Colour < 255
Br_Colour++
Else
Br_Colour = 255
Endif
Counter++
EndWhile
Goto Wait_for_Input